<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="f" uri="http://www.sctv.com/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/views/head.jsp"/>
    <script type="text/javascript">
        function confirmDelete() {
            return confirm("<s:message code='confirmDelete'/>");
        }

        /*-------------------------------[ 异步 刷新获取 刷新  数据 ]-------------------------------- */
        function groupViews() {//类型分组信息
            var typeId = $('#groupView option:selected').val();
            if (typeId == "" || typeId == 'no') {
                return false;
            }
            var data = {};
            data.orgId = typeId;
            var array = ajaxView("/cmscp/ext/livebroadcast/groupView.do", "json", data);
            var value ="<option value='no'>无数据</option>";
            $("#set_User_View").empty();
            if(array.length>0){
                /*-----------------------[ 类型分组信息 ]----------------------------*/
                value = "<option value='no'>请选择用户</option>";
                for (var i = 0; i < array.length; i++) {
                    value += "<option value='" + array[i].id + "'>" + array[i].name + "</option>";
                }
            }
            $("#set_User_View").append(value);
        }

        function setUserViweId() {
            var add_user_Id = $('#set_User_View option:selected').val();
            var add_user_Name = $('#set_User_View option:selected').text();
            if (add_user_Id == "" || add_user_Id == 'no') {
                return false;
            }
            /*-----------------[赋值 更新的值 ]-----------------*/
            $('#add_user_Name').val(add_user_Name);
            $('#add_user_Id').val(add_user_Id);
        }


        function ajaxView(mothe, datatype, data) {
            var obj;
            var strurl = window.location.host;
            $.ajax({
                type: "POST",
                url: "http://" + strurl + mothe,
                dataType: datatype,
                data: data,
                async: false,
                success: function (msg) {
                    obj = msg;
                },
                error: function (msg) {
                }
            });
            return obj;
        }

        function clearLive(){
          $("#userId").val("");
          $("#userIdName").val("");
        }
    </script>
</head>
<body class="skin-blue content-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="content-header">
    <h1>直播地址 - <s:message code="edit"/></h1>
</div>
<c:set var="numberExist"><s:message code="vote.number.exist"/></c:set>
<div class="content">
    <div class="box box-primary">
        <form class="form-horizontal" id="validForm" action="liveUpata.do" method="post">
            <input type="hidden" id="redirectLive" name="redirect" value="update"/>
            <f:hidden name="liveBroadcast.id" value="${address.liveBroadcast.id}"/>
            <f:hidden name="stat" value="${stat}"></f:hidden>
            <f:hidden name="id" value="${address.id}"></f:hidden>
            <f:hidden name="streamName" value="${address.streamName}"></f:hidden>
            <f:hidden name="imputAddress" value="${address.imputAddress}"></f:hidden>
            <f:hidden name="outAddress" value="${address.outAddress}"></f:hidden>
            <%--------------------------[  获取分组  数据  ]-----------------------------%>

            <div class="row">
                <div class="form-group" style="margin-top: 10px;">
                    <label class="col-sm-2 control-label"><em class="required">*</em>直播-用户</label>
                    <f:hidden name="userId" value="${address.user.id}" id="userId" ></f:hidden>
                    <div class="col-sm-5">
                        <f:text id="userIdName" value="${address.user.username}" disabled="disabled"
                                class="form-control required" maxlength="150"/>
                      <button class="btn btn-default" id="userIdButton" type="button">选择</button>
                      <button class="btn btn-default" onclick="clearLive()" type="button">清除</button>
                    </div>
                </div>
                <script type="text/javascript">
                  $(function(){

                    $(function() {
                      Cms.f7.liveuser("userId","userIdName",{
                        settings: {"title": "指定直播用户"}
                      });
                    });
                  });
                </script>
                <%--<div class="form-group">--%>
                    <%--<div class="col-sm-111">--%>
                            <%--<label class="col-sm-2 control-label"><em class="required">X</em>分组类型</label>--%>
                            <%--<div class="col-sm-2">--%>
                                <%--<select class="form-control input-sm" name="" id="groupView"--%>
                                        <%--onchange="groupViews()">--%>
                                    <%--<f:option value="no">请选择组</f:option>--%>
                                    <%--<c:forEach var="bean" varStatus="status" items="${orgList}">--%>
                                        <%--<c:if test="${empty bean.parent}">--%>
                                        <%--<f:option value="${bean.id}"  default="0">${bean.name}</f:option>--%>
                                        <%--</c:if>--%>
                                        <%--<c:forEach var="bean1" varStatus="status" items="${bean.children}">--%>
                                            <%--<f:option value="${bean1.id}" default="0">--${bean1.name}</f:option>--%>
                                        <%--</c:forEach>--%>
                                    <%--</c:forEach>--%>
                                <%--</select>--%>
                            <%--</div>--%>
                        <%--<div class="col-sm-6">--%>
                            <%--<label class="col-sm-2 control-label">用户信息</label>--%>
                            <%--<div class="col-sm-3">--%>
                                <%--<select class="form-control input-sm" name="" id="set_User_View"--%>
                                        <%--onchange=" return setUserViweId()">--%>
                                <%--</select>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>

                <%--</div>--%>
            </div>

            <div class="row">
                <div class="form-group">
                    <label class="col-sm-2 control-label"><em class="required">*</em>输入地址</label>
                    <div class="col-sm-5">
                        <f:text name="" value="${address.imputAddress}" disabled="disabled"
                                class="form-control required" maxlength="150"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><em class="required">*</em>输出地址</label>
                    <div class="col-sm-5">
                        <f:text name="" value="${address.outAddress}" disabled="disabled"
                                class="form-control required" maxlength="150"/>
                    </div>
                </div>
            </div>
            <%-----------------------------------------------------------[  按钮 保存 如下:  ]----------------------------------------------------------------------------------%>
            <div class="box-footer">
                <button class="btn btn-primary" type="submit" onclick="$('#redirectLive').val('liveEdit');">
                    <s:message
                            code="save"/></button>
                <button class="btn btn-default" type="submit" onclick="$('#redirectLive').val('edit');"><s:message
                        code="saveAndReturn"/></button>
            </div>

        </form>
    </div>
</div>
</div>
</body>
</html>